package ar.edu.unq.wannaplay.client;

import ar.edu.unq.wannaplay.entity.Entity;

public class Client extends Entity {
    private static final long serialVersionUID = 1L;

    private String name;

    private String email;

    private String address;

    private String town;

    public Client() {
        super();
    }

    public Client(final String name, final String email, final String address, final String town) {
        super();
        this.name = name;
        this.email = email;
        this.address = address;
        this.town = town;
    }

    public String getName() {
        return name;
    }

    public void setName(final String name) {
        this.name = name;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(final String email) {
        this.email = email;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(final String address) {
        this.address = address;
    }

    public String getTown() {
        return town;
    }

    public void setTown(final String town) {
        this.town = town;
    }

    @Override
    public String toString() {
        return this.getName() + ", " + this.getEmail();
    }

    @Override
    public boolean equals(final Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || !(obj instanceof Client)) {
            return false;
        }

        Client other = (Client) obj;

        if (this.getId() == other.getId()) {
            return true;
        }
        if ((Integer) this.getId() == null) {
            return false;
        }

        // equivalence by id
        return ((Integer) this.getId()).equals(other.getId());
    }

    @Override
    public int hashCode() {
        if ((Integer) this.getId() != null) {
            return ((Integer) this.getId()).hashCode();
        } else {
            return super.hashCode();
        }
    }

}
